# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-construct
pkgver=2.10.69
pkgrel=1
pkgdesc="A powerful declarative parser/builder for binary data"
arch=('any')
license=('MIT')
url="https://construct.readthedocs.org"
depends=('python')
makedepends=('python-setuptools')
checkdepends=('python-arrow' 'python-cloudpickle' 'python-lz4' 'python-numpy' 'python-pytest-runner'
              'python-pytest-benchmark' 'python-ruamel-yaml' 'python-cryptography')
optdepends=('python-arrow: for Timestamp'
            'python-numpy: for array serialization with Numpy protocol'
            'python-ruamel-yaml: for KaitaiStruct (KSY) exporter')
source=("$pkgname-$pkgver.tar.gz::https://github.com/construct/construct/archive/v$pkgver.tar.gz")
sha512sums=('c94a1b3a62c9bf4aed30eb262d4439452f98fe909e399d79ece8da4aa707f95c754d540672c2cc9c307425914e43384b5455eb7970ab5d7830af1c0b06313f9e')

build() {
  cd construct-$pkgver
  python setup.py build
}

check() {
  cd construct-$pkgver
  python setup.py pytest
}

package() {
  cd construct-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
